const app = getApp();

Component({
  properties: {
    params: {
      type: Object,
      value: {}
    }
  },
  options: {
    addGlobalClass: true
  },
  data: {
    current: 0
  },
  ready() {
    const {
      style,
      autoplay,
      padding,
      height,
      background,
      indicatorActiveColor,
      indicatorColor,
      indicatorDots,
      interval,
      images
    } = this.properties.params
    
    this.setData({
      style: style,
      padding: padding,
      height: height,
      background: background,
      autoplay: autoplay,
      interval: interval,
      indicatorDots: indicatorDots,
      indicatorColor: indicatorColor,
      indicatorActiveColor: indicatorActiveColor,
      images: images
    });
  },
  methods: {
    change: function (event) {
      this.setData({
        current: event.detail.current
      })
    },

    redirect(event) {
      if (event.currentTarget.dataset.link) {
        app.redirect(event.currentTarget.dataset.link);
      }
    }
  }
})